<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/pages/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="Generator" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>鹰牌陶瓷合肥运营中心</title>
<link href="${ctx}/css/sub/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="${ctx}/themes/default/default.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/css/main.css" type="text/css" />
<!-- IE6 fixes are found in styles/ie6.css -->
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="${ctx}/css/ie6.main.css" /><![endif]-->
</head>
<body style="background: none repeat scroll 0 0 #FFFFFF;">
<div id="main" style="width: 790px;">
  <div id="bd" style="width: 790px;">
    
    <div id="bd_right2" class="news" style="width: 790px; ">
        <div class="mt">
		   <h2>产品展示</h2>
		   <div class="extra">${title}</div>
	  	</div>
        <div class="product_ul_list" style="margin-left: 4px;">
			<ul>
				<c:forEach var="cur" items="${entityList}" varStatus="vs">
					 <c:set value="${fn:length(cur.product_name)}" var="len1" />
					 <c:set value="${fn:length(cur.product_model)}" var="len2" />
					 <li style="height: 170px;">
					    <input type="hidden" name="product_id" id="product_id" value="${cur.product_id}" />
	                    <div class="picimg"><a title="请双击选择" ><img src="${ctx}/${cur.accessory.save_url}"></a></div>
	                    <div class="producttext">
                 		 	<div class="zs_opacity">
                 		 		<p>品名：
                		 		  <c:choose>
			                  	    <c:when test="${len1 gt 11}"><span title="${cur.product_name}">${fn:substring(cur.product_name,0,11)}</span></c:when>
			                  	    <c:when test="${len1 le 11}"><span title="${cur.product_name}">${cur.product_name}</span></c:when>
			                	  </c:choose>
                 		 		</p>
                 		 		<p>型号：
                 		 		  <c:choose>
		                        	<c:when test="${len2 gt 11}"><span title="${cur.product_model}">${fn:substring(cur.product_model,0,11)}</span></c:when>
				                	<c:when test="${len2 le 11}"><span title="${cur.product_model}">${cur.product_model}</span></c:when>
		                      	  </c:choose>
                 		 		</p>
                 		 	</div>
                 		 	<c:if test="${cur.is_recommend eq 1}"><c:set var="state" value="block" /></c:if>
                 		 	<c:if test="${cur.is_recommend eq 0}"><c:set var="state" value="none" /></c:if>
                 		 	<div class="product_recommend" id="product_recommend" style="display: ${state};cursor: pointer;"></div>
		                </div>
                    </li>
				</c:forEach>
			</ul>
			<div style="clear: both;"></div>
			<form id="bottomPageForm" name="bottomPageForm" method="post" action="RecommendProduct.do">
		      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		        <tr>
		          <td height="40" align="center"><script type="text/javascript" src="${ctx}/commons/scripts/pager.js">;</script>
		            <script type="text/javascript">
		            var pager = new Pager(document.bottomPageForm, ${hf.map.pager.recordCount}, ${hf.map.pager.pageSize}, ${hf.map.pager.currentPage});
		            pager.addHiddenInputs("method", "productSelect");
		            pager.addHiddenInputs("mod_id", "${hf.map.mod_id}");
		            pager.addHiddenInputs("type2_id", "${hf.map.type2_id}");
		            pager.addHiddenInputs("type2_name", "${hf.map.type2_name}");
		            document.write(pager.toString());
		            </script>
		          </td>
		        </tr>
		      </table>
		    </form>
		</div>
    </div>
  </div>
</div>
<script type="text/javascript" src="${ctx}/commons/scripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	
});

$('li').dblclick(function(){
	var recommend_display = $(this).find("#product_recommend");
	var product_id = $(this).find("#product_id").val();
	var is_recommend = 0;
	if(recommend_display.css("display") == "block"){
		is_recommend = 0;
	}else{
		is_recommend = 1;
	}

	$.ajax({
		   async: false,
		   type: "POST",
		   url: "RecommendProduct.do",
		   data: "method=save&product_id=" + product_id + "&is_recommend=" + is_recommend,
		   dataType: "json",
		   error: function(request, settings) {/*alert("数据请求失败！"); */},
		   success: function(data) {
			  if(data == 1){
				  if(is_recommend == 0){ //取消推荐
					  recommend_display.hide("Fold", null, 500, null);
				  }else{ //选择推荐
					  recommend_display.show("Fold", null, 500, null);
				  }
			  }else{
				  alert("选择失败，请重新双击选择");
			  }
		   }
	   });

	is_recommend = null; 
});
	
//打开弹出框后
function showAdv(){
	$("#main").css("display","none");
	$("#colorbox").css("display","none");
}

//关闭弹出框后
function closeAdv(){
	$("#main").css("display","block");
}
 </script>
</body>
</html>
